package com.nidu.demo.log.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nidu.demo.log.mapper.dataobject.LoginLogDO;
import com.nidu.demo.log.model.LoginLog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 登录日志Mapper
 *
 * @author auto
 */
@Mapper
public interface LoginLogMapper extends BaseMapper<LoginLogDO> {

    @Delete("delete from sys_login_log")
    void deleteAll();

    @Select("select * from sys_login_log where user_id = #{userId} and result = 1 order by create_time desc")
    LoginLog getLastLoginSuccessLog(Long userId);
}
